#include <bits/stdc++.h>

using namespace std;

/* 2.818 2.968 2.984 2.805 2.437: 2.802, NR = 1000 */
#define TEST_TIME       2.802
#define NR              15000
#define weights(i)      2
#define COLUMNS         55

void puttime(int i);


int main() {
	int i, j, flag, p, k;
	int prev, n, total, optim;

	freopen("out.txt", "w", stdout);

	prev = 2;
	n = 0;
	total = 0;

	// fprintf(stderr, "\033[0;32m");
	/* doesn't work on windows */

	for (i = 0; i < COLUMNS; i++) {
		putc('=', stderr);
	}

	putc('\n', stderr);

	for (i = 2; i <= NR; i++) {
		flag = 1;
		optim = sqrt(i);

		for (j = 2; j < optim; j++) {
			if (i % j == 0) {
				flag = 0;
				total++;

				break;
			}
		}

		if (flag) {
			cout << i << endl;
		}

		if (i - prev > n) {
			n = i - prev;
			prev = i;
		}
		
		putc('\r', stderr);

		for (p = 0; p < (double) i / NR * COLUMNS - 1; p++) {
			putc('-', stderr);
		}

		putc('>', stderr);

		for (k = 0; k < COLUMNS - p; k++) {
			putc(' ', stderr);
		}

		fprintf(stderr, " %7.4lf%%", (double) i * 100 / NR);
		puttime(i);
	}

	putc('\n', stderr);

	system("color");

	cerr << n << endl;
	cerr << "total " << total << endl;

	return 0;
}


void puttime(int i) {
    double secs = (NR - (double) i) / 1000 * TEST_TIME * weights(i);
    
	if (secs <= 60)  {
		fprintf(stderr, "  eta      %2ds", (int) secs);
    }
    
    else {
        fprintf(stderr, "  eta %3dm %2ds", (int) secs / 60, (int) secs % 60);
    }
    
    return;
}